#ifndef VIEWOPENGL_H
#define VIEWOPENGL_H

#include <QtGui>
#include <bitset>
#include <vector>
#include "../ccube.h"
#include "../CDemData.h"
#include "../QtApi/QtOpenGlPlus.h"
#include "../SM/MatriceGL.h"

class viewOpenGl : public QtOpenGlPlus {
  Q_OBJECT
private:
  std::vector<CCube *>cube ;
  CDemData DemTerra;
  float near_plane,
        far_plane ;
  bool bLoading;

//---Eyes
  float eyeX,
        eyeY,
        eyeZ ;
//---Camera
  float camX,
        camY,
        camZ ;
  float phy,
        theta ;
//---Keyboard
  bitset<6> keyActive ;
  QTimer keyTimer ;
  int keySpeed ;
  float keyIncrement ;

//---Matrice
  MatriceGL matProjection ;
  MatriceGL matModelview ;
  
public:
  viewOpenGl(QWidget *parent=0);
  ~viewOpenGl() ;

  void initGL() ;
  bool callback_idle();
  void callback_reshape(int width, int height) ;
  void callback_display() ;
  void initObject3D();

protected slots:
  bool keyIdle() ;
  
protected:
  //------Input------
  void keyPressEvent ( QKeyEvent * event ) ;
  void keyReleaseEvent ( QKeyEvent * event ) ;
  void mouseMoveEvent ( QMouseEvent * event ) ;

private:
  void initCarteObject() ;
};
#endif
